一 版本说明
- flannel : v0.11.0
- etcd集群: 沿用上一章节的集群 v3.4.3
二 在node安装docker
1 | 先在node上安装docker |
二 etcd设置子网网段
1 | # 设置环境变量 从etcd3.4之后 默认etcdctl的api版本是3 所以需要通过环境变量改变 |
1 | /opt/etcd/bin/etcdctl \ |
三 下载并安装flannel
1 | wget https://github.com/coreos/flannel/releases/download/v0.11.0/flannel-v0.11.0-linux-amd64.tar.gz |
四 检查是否生效
确保flannel.1与docker0在同一网段,在另一台机器ping 172.17.97.1能ping通1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:cd:68:2a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.211/24 brd 192.168.0.255 scope global noprefixroute ens3
valid_lft forever preferred_lft forever
inet6 fe80::f62:962d:1386:352/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: flannel.1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN group default
link/ether 42:1b:0c:33:56:de brd ff:ff:ff:ff:ff:ff
inet 172.17.97.0/32 scope global flannel.1
valid_lft forever preferred_lft forever
inet6 fe80::401b:cff:fe33:56de/64 scope link
valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:4a:1f:8a:bb brd ff:ff:ff:ff:ff:ff
inet 172.17.97.1/24 brd 172.17.97.255 scope global docker0
valid_lft forever preferred_lft forever